<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>应聘者登录</title>
    <link rel="stylesheet" href="css/style.css">
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }
        .container {
            background-color: white;
            padding: 20px;
            border-radius: 12px;
            box-shadow: 0 6px 16px rgba(0,0,0,0.08);
            width: 400px;
        }
        .form-group {
            margin-bottom: 15px;
        }
        label {
            display: block;
            margin-bottom: 5px;
        }
        input[type="text"], input[type="password"] {
            width: 100%;
            padding: 8px;
            box-sizing: border-box;
        }
        button[type="submit"] {
            background-color: var(--seeker-primary);
            color: white;
            padding: 10px 15px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            width: 100%;
        }
        button[type="submit"]:hover {
            background-color: var(--seeker-primary-dark);
        }
        .register-link {
            margin-top: 15px;
            text-align: center;
        }
    </style>
</head>
<body>
    <div class="container">
        <h2>应聘者登录</h2>
        <form id="jobSeekerLoginForm">
            <div class="form-group">
                <label for="loginAccount">手机号</label>
                <input type="text" id="loginAccount" required placeholder="请输入手机号">
            </div>
            <div class="form-group">
                <label for="loginPassword">密码</label>
                <input type="password" id="loginPassword" required placeholder="请输入密码">
            </div>
            <button type="submit">登录</button>
            <div class="register-link">
                还未注册？<a href="register.html?role=jobSeeker">立即注册</a>
            </div>
        </form>
    </div>

    <script>
        document.getElementById('jobSeekerLoginForm').addEventListener('submit', function(e) {
            e.preventDefault();
            const account = document.getElementById('loginAccount').value;
            const password = document.getElementById('loginPassword').value;
            
            // 从localStorage获取已注册用户信息（实际开发中应调用后端API）
            const registeredUsers = JSON.parse(localStorage.getItem('jobSeekerUsers') || '[]');
            const user = registeredUsers.find(u => u.phone === account && u.password === password);
            
            if (user) {
                alert('登录成功，即将跳转到个人中心');
                setTimeout(() => window.location.href = 'job-seeker-dashboard.html', 1500);
            } else {
                alert('账号或密码错误，或未注册');
                window.location.href = 'register.html?role=jobSeeker';
            }
        });
    </script>
</body>
</html>